import 'project_commissioner.dart';

class ProDetailModel {
  String? id;
  String? projectName;
  String? projectContent;
  String? projectContentAlias;
  String? projectAlias;
  String? assignedLeader;
  String? investmentQuota;
  int? employmentNumber;
  String? projectType;
  String? remark;
  List<ProjectCommissioner>? projectCommissioner;
  String? completeLimit;
  String? createBy;
  String? createByName;
  String? createTime;

  ProDetailModel({
    this.id,
    this.projectName,
    this.projectContent,
    this.projectContentAlias,
    this.projectAlias,
    this.assignedLeader,
    this.investmentQuota,
    this.employmentNumber,
    this.projectType,
    this.remark,
    this.projectCommissioner,
    this.completeLimit,
    this.createBy,
    this.createByName,
    this.createTime,
  });

  factory ProDetailModel.fromJson(Map<String, dynamic> json) {
    return ProDetailModel(
      id: json['id'] as String?,
      projectName: json['projectName'] as String?,
      projectContent: json['projectContent'] as String?,
      projectContentAlias: json['projectContentAlias'] as String?,
      projectAlias: json['projectAlias'] as String?,
      assignedLeader: json['assignedLeader'] as String?,
      investmentQuota: json['investmentQuota'] as String?,
      employmentNumber: json['employmentNumber'] as int?,
      projectType: json['projectType'].toString(),
      remark: json['remark'] as String?,
      projectCommissioner: (json['projectCommissioner'] as List<dynamic>?)
          ?.map((e) => ProjectCommissioner.fromJson(e as Map<String, dynamic>))
          .toList(),
      completeLimit: json['completeLimit'] as String?,
      createBy: json['createBy'] as String?,
      createByName: json['createByName'] as String?,
      createTime: json['createTime'] as String?,
    );
  }

  Map<String, dynamic> toJson() => {
        'id': id,
        'projectName': projectName,
        'projectContent': projectContent,
        'projectContentAlias': projectContentAlias,
        'projectAlias': projectAlias,
        'assignedLeader': assignedLeader,
        'investmentQuota': investmentQuota,
        'employmentNumber': employmentNumber,
        'projectType': projectType,
        'remark': remark,
        'projectCommissioner':
            projectCommissioner?.map((e) => e.toJson()).toList(),
        'completeLimit': completeLimit,
        'createBy': createBy,
        'createByName': createByName,
        'createTime': createTime,
      };
}
